{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "plot_x = np.linspace(-1,6,141)\n",
    "plot_y = (plot_x -2.5) **2 -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deVyVZd7H8c+PHRRQZBFkVXBX1Mi90rQstZyapmxxqmmbmpbpaeppmn2reWamZ9qbaXfKtDQrK1vNyswNNVdQAdkREBWQ/Ryu5w9wHsdc4cB97nN+79eLl0B07m9IXy+v+7quW4wxKKWUsh8fqwMopZTqGC1wpZSyKS1wpZSyKS1wpZSyKS1wpZSyKb/uvFhkZKRJTk7uzksqpZTtbdy4cb8xJurYz3drgScnJ5OZmdmdl1RKKdsTkYLjfV6nUJRSyqa0wJVSyqa0wJVSyqa0wJVSyqa0wJVSyqa0wJVSyqa0wJVSyqZsUeAfbC1jwbrjLoNUSim3VnKogT9/mE1FbaPLX9sWBb58Wxl/+3gXTQ6n1VGUUuqMvLGhiH9+lUuzo9Xlr22LAr/q7AQO1rfw8Y5yq6MopdRpc7YaFmcWcU5aFPG9Q1z++rYo8MmpkcT3DuaNDYVWR1FKqdP21e5KyqobufrshC55fVsUuI+PcFVGAqtzqiioqrM6jlJKnZaF6wuJ7BnAtCExXfL6tihwgCsy4vGRtvkkpZRydxU1jazIruD7Y+IJ8OuaqrVNgceGBzN1UDSLNxbjcLr+ZoBSSr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AVD0ZJtHFzaDAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(plot_x,plot_y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def dJ(theta):\n",
    "    return 2*(theta-2.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def J(theta):\n",
    "    return (theta-2.5)**2 -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.499891109642585\n",
      "-0.99999998814289\n"
     ]
    }
   ],
   "source": [
    "theta = 0.0\n",
    "epsilon = 1e-8\n",
    "eta = 0.1\n",
    "while True:\n",
    "    gradient = dJ(theta)\n",
    "    last_theta = theta\n",
    "    theta = theta - eta * gradient\n",
    "    \n",
    "    if abs(J(theta) - J(last_theta)) < epsilon:\n",
    "        break\n",
    "        \n",
    "print(theta)\n",
    "print(J(theta))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.4999580569599997\n",
      "-0.9999999982407813\n"
     ]
    }
   ],
   "source": [
    "theta = 0.0\n",
    "epsilon = 1e-8\n",
    "theta_history = [theta]\n",
    "eta = 0.3\n",
    "while True:\n",
    "    gradient = dJ(theta)\n",
    "    last_theta = theta\n",
    "    theta = theta - eta * gradient\n",
    "    theta_history.append(theta)\n",
    "    if abs(J(theta) - J(last_theta)) < epsilon:\n",
    "        break\n",
    "        \n",
    "print(theta)\n",
    "print(J(theta))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgo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AghTOr/AfuRrvL+KCNBAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(plot_x,J(plot_x))\n",
    "plt.plot(np.array(theta_history),J(np.array(theta_history)),color='r')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(theta_history)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
